<template>
	<div>
		<!--算法 选择-->
		<baseSelect 
			ref="baseSelect"
			:defaultValue="defaultValue" 
			:optionList="options" 
			:filterable="true"
			@change="changeHandel"></baseSelect>
	</div>
</template>

<script>
	import baseSelect from "@/view/components/select/select";
	import {getAcDictByTypeName} from "@/service/swagger/AcDictController";
	
	export default {
		components : {
			baseSelect
		},
		props:[
			"defaultValue"
		],
		data(){
			return {
				options: [],
			}
		},
		mounted(){
			this.getData();
		},
		methods : {
			changeHandel(name , v){
				this.$emit("change", "suanfaSelect", v)
			},
			
			getData(){
				getAcDictByTypeName({
					typeName : "balance_type"
				}).then(ret=>{
					this.options = ret.data.map(el=>{
						return {
							label : el.name,
							value : el.value,
						}
					})
					
					// 时间下拉需选取默认
					this.$refs.baseSelect.asyncUpdateOption(this.options);
				})
			},
			
			reset(){
				this.$refs.baseSelect.reset()
			}
		}
	}
</script>

<style>
</style>